# Contributor: Sean McAvoy <seanmcavoy@gmail.com>
# Maintainer: Sean McAvoy <seanmcavoy@gmail.com>
pkgname=speedtest-go
pkgver=1.1.4
pkgrel=3
pkgdesc="web page based speed test, written in go"
url="https://librespeed.org"
arch="all"
license="LGPL-3.0-only"
makedepends="go"
options="!check" # no check suite
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/librespeed/speedtest-go/archive/v$pkgver.tar.gz
	speedtest-go.initd
	settings-change.patch"

build() {
	go build -ldflags "-w -s" -trimpath -o speedtest main.go
}

package() {
	install -Dm755 "$srcdir"/speedtest-go.initd "$pkgdir"/etc/init.d/speedtest-go
	install -Dm644 settings.toml "$pkgdir"/etc/speedtest-go/settings.toml
	install -Dm755 speedtest "$pkgdir"/usr/bin/speedtest
	install -Dm644 -t "$pkgdir"/usr/share/$pkgname/assets web/assets/*
	install -Dm644 -t "$pkgdir"/usr/share/doc/$pkgname/ ./*.md
}

sha512sums="
e02f75bddcffe68c3f131b0dcc75a65912b8538fdb4438f53ff12425f2b7cacfcbffd10c26f71a73a0a5cd6d4e49922d3a847c8861d3ee8e2a1ad77c9f78ee0f  speedtest-go-1.1.4.tar.gz
197efb6f98bed3a09c1c71e520265b48671c8e4dddabf3f9d7f16e8384e1ef84b800a115d5c656fb47e48d07a92cfe387f2dba5b9801fa03e720f762c6394ff7  speedtest-go.initd
e7b0776bd9f4b10b763c4be7a51f388b1a213be979e98438c97e7da216d894044cf207c09e949b14b234cbae97e0f41474a885d5f5fa41e60add06912093ccc6  settings-change.patch
"
